<style scoped>
  .print{
    width: 230px;
    height: 120px;
    background: white;
    position: absolute;
    top: 30%;
    left: 35%;
    padding: 10px 15px;
    box-shadow: 3px 3px 3px #f4f4f4;
  }
  .print div:first-child{
    font-weight: 700;
    margin-bottom: 5px;
  }
  .print div:last-child{
    float: right;
    margin: 10px 0 0 0;
  }
  .clientIntegratedQuery {
    margin-right: 0.5vw;
    padding: 0 15px;
    background-color: white;
    height: 95vh;
    position: relative;
    width: 69%;
  }
  .CIQ_top{
    display: flex;
    padding: 15px 0;
    border-bottom: 2px solid #f4f4f4;
  }
  .top_inp{
    width: 8vw;
  }
  .top_inp1{
    width: 8vw;
  }
  .CIQ_top p:first-child{
    margin: 3px 6px 0 0;
    display: inline-block;
    white-space:nowrap;
  }
  .CIQ_top p:not(:first-child){
    margin: 3px 6px 0 12px;
    display: inline-block;
    white-space:nowrap;
  }

  .clientIntegratedQuery-right{
    background: white;
    width: 29.5%;
    padding: 0.5vw;
  }
  .clientIntegratedQuery-right>div:not(:last-child){
    white-space: nowrap;
    margin-bottom: 4px;
  }
  .clientIntegratedQuery-right p{
    display: inline-block;
    text-align: right;
    line-height: 30px;
    width: 75px;
    margin-right: 5px;
  }
  .RUstupid .mask{
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    opacity: 0.3;
    z-index: 9;
  }
  .RUstupid .no-distribution{
    position: fixed;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    width: 1000px;
    z-index: 99;
    background-color: white;
  }
  .RUstupid .no-distribution>div:last-child{
    margin:20px;
    max-height:400px;
    overflow: auto;
    display: flex;
    flex-wrap: wrap;

  }
  .RUstupid .no-distribution span {
    margin: 0;
    line-height: 36px;
    display: inline-block;
    padding-left: 10px;
    height: 36px;
    width: 140px;
    border: #f4f4f4 solid 2px;
  }
  .RUstupid .no-distribution .no-distribution-top{
    height: 40px;
    background-color: #f8f8f8;
  }
  .RUstupid .no-distribution .no-distribution-top p{
    float: left;
    line-height: 40px;
    padding-left: 20px;
  }
  .RUstupid .no-distribution .no-distribution-top i{
    float: right;
    line-height: 40px;
    padding: 0 16px;
  }

  .RUstupid #imgBox{ 
    position: absolute;
    width: auto;
    height: auto;
    z-index: 4;
  }
  .RUstupid #imgBox .imgTop{
    background-color: #f4f4f4;
    height: 30px;
    padding-left: 10px;
  }
  .RUstupid #imgBox .imgTop i{
    float: right;
    height: 30px;
    width: 30px;
    line-height: 30px;
  }
  #imgBox .img{
    max-width: 40vw;
    max-height: 40vh;
  }
  .RUstupid #imgBox img{
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
  }
</style>

<style>
  .clientIntegratedQuery .el-input__icon, .clientIntegratedQuery-right .el-input__icon{
    line-height: 30px;
  }
  .CIQ_top .el-input__inner{
    height: 30px;
  }
  .CIQ_top .el-checkbox:last-of-type{
    padding: 5px 0 0 0;
  }
  .clientIntegratedQuery-right .el-input__inner{
    height: 30px;
  }
  .clientIntegratedQuery-right .el-date-editor .el-range-separator{
    line-height: 21px;
    width: 8%;
  }
  .clientIntegratedQuery-right .el-date-editor .el-range__icon{
    line-height: 23px;
  }
  .clientIntegratedQuery-right .block .el-date-editor--daterange.el-input__inner{
    width: 20vw;
  }
  .clientIntegratedQuery .el-table thead tr:last-child .cell{
    padding: 0;
    /* height: 36px!important; */
  }
  .clientIntegratedQuery .el-table tbody td .cell{
    padding: 0;
  }
  .clientIntegratedQuery .el-table__footer td {
	height:36px;
}
</style>

<template>
  <div class="RUstupid">
    <div style="display:flex;">
      <div class="clientIntegratedQuery">
        <div class="CIQ_top">
          <p>款号</p>
          <el-input ref="styleNumberSearch" class="top_inp" v-model="styleNumber" @keyup.enter.native="styleNumberEnter"></el-input>
          <p>客户编号</p>
          <el-select multiple collapse-tags clearable class="top_inp" v-model="customerNo" :disabled="jxAgent || Dis1">
            <el-option v-for="item in customerList" :key="item.value" :label="item.label" :value="item.value">
              <span style="float:left">{{item.value}}</span>
              <span style="float:right">{{item.label}}</span>
            </el-option>
          </el-select>
          <p>总店汇总</p>
          <el-select :disabled="Dis2" style="width:8vw;" v-model="headquartersNo">
            <el-option v-for="item in headquartersList" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
          <p>售价</p>
          <el-input class="top_inp" disabled v-model="sellingPrice"></el-input>
          <el-button @click="noDistributionClick" style="margin:0 10px 0 10px;" icon="el-icon-user">未配客户</el-button>
          <el-checkbox v-model="checked">显示图片</el-checkbox></div>
        <div style="display:flex;justify-content:flex-end;">
          <i class="el-icon-question" style="color:#017fff;margin:4px 6px 0 0;"></i>
          <p>注意：红色为退货，黄色为滞销，灰色为调货</p>
        </div>
        <div style="display:flex;">
          <el-table 
            :data="tableData1" 
            style="width: 100%" 
            height="85vh" 
            show-summary 
            ref="table1" 
            :header-cell-style="{background:'#f4f4f4',padding:0}" 
            :cell-style="changeCellStyle" 
            @cell-dblclick="cellDblclick" 
            @row-click="rowClick">
            <el-table-column fixed prop="colorStr" label="色" width="80"></el-table-column>
            <!-- <el-table-column fixed prop="colorName" label="色" width="50"></el-table-column> -->
            <el-table-column fixed prop="customerRepertory" label="客存" width="36"></el-table-column>
            <el-table-column fixed prop="customerName" label="客户/简称" min-width="100" show-overflow-tooltip :render-header="renderheader" align="center"></el-table-column>
            <el-table-column fixed prop="customerSell" label="销" width="40"></el-table-column>
            <el-table-column fixed prop="nearSellTime" label="近销日" width="90"></el-table-column>
            <el-table-column fixed prop="nearInputTime" label="近进日" width="90"></el-table-column>
            <el-table-column label="客户进货">
              <el-table-column prop="inputC05" label="05" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputC07" label="07" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputC09" label="09" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputC11" label="11" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputC13" label="13" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputC15" label="15" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputC17" label="17" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputC19" label="19" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputC21" label="21" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputC23" label="23" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="inputF" label="F" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inputToolTipContent(scope)" placement="top" :disabled="showInputToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column label="客户销货">
              <el-table-column prop="sellC05" label="05" min-width="24"></el-table-column>
              <el-table-column prop="sellC07" label="07" min-width="24"></el-table-column>
              <el-table-column prop="sellC09" label="09" min-width="24"></el-table-column>
              <el-table-column prop="sellC11" label="11" min-width="24"></el-table-column>
              <el-table-column prop="sellC13" label="13" min-width="24"></el-table-column>
              <el-table-column prop="sellC15" label="15" min-width="24"></el-table-column>
              <el-table-column prop="sellC17" label="17" min-width="24"></el-table-column>
              <el-table-column prop="sellC19" label="19" min-width="24"></el-table-column>
              <el-table-column prop="sellC21" label="21" min-width="24"></el-table-column>
              <el-table-column prop="sellC23" label="23" min-width="24"></el-table-column>
              <el-table-column prop="sellF" label="F" min-width="24"></el-table-column>
            </el-table-column>
            <el-table-column label="客户库存">
              <el-table-column prop="customerRepertoryC05" label="05" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryC07" label="07" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryC09" label="09" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryC11" label="11" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryC13" label="13" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryC15" label="15" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryC17" label="17" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryC19" label="19" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryC21" label="21" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryC23" label="23" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
              <el-table-column prop="customerRepertoryF" label="F" min-width="24">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" :content="inventoryToolTipContent(scope)" placement="top" :disabled="showInventoryToolTip(scope)">
                    <p>{{scope.row[scope.column.property]}}</p>
                  </el-tooltip>
                </template>
              </el-table-column>
            </el-table-column>
          </el-table>
        </div>
      </div>
      <div class="clientIntegratedQuery-right">
        <div>
          <p>调货日期</p>
          <div class="block" style="display:inline-block">
            <el-date-picker unlink-panels v-model="dateList" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" @change="_getCustomerTransfer"></el-date-picker>
          </div>
        </div>
        <div>
          <p>调出客户</p>
          <el-input :disabled="Dis" style="width:3vw;margin-right:0.5vw;" v-model="outNo" @blur="outNoBlur"></el-input>
          <el-select :disabled="Dis" style="width:4.5vw;" v-model="outName" @change="e=>{this.outNo=e;this._getCustomerTransfer();}">
            <el-option v-for="item in customerList" :key="item.value" :label="item.label" :value="item.value">
              <span style="float:left">{{item.value}}</span>
              <span style="float:right">{{item.label}}</span></el-option>
          </el-select>
          <p>调入客户</p>
          <el-input style="width:3vw;margin-right:0.5vw;" v-model="inputNo" @blur="inputNoBlur"></el-input>
          <el-select style="width:4.5vw;" v-model="inputName" @change="e=>{this.inputNo=e;this._getCustomerTransfer();}">
            <el-option v-for="item in customerList" :key="item.value" :label="item.label" :value="item.value">
              <span style="float:left">{{item.value}}</span>
              <span style="float:right">{{item.label}}</span></el-option>
          </el-select>
        </div>
        <div>
          <p>限寄日期</p>
          <el-date-picker class="top_inp1" v-model="inputDate" type="date" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期"></el-date-picker>
          <p>操作员</p>
          <el-select class="top_inp1" v-model="operator" @change="_getCustomerTransfer">
            <el-option v-for="item in operatorList" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </div>
        <div>
          <el-button @click="transfer('直接调转')" icon="el-icon-set-up" :disabled="jxAgent">直接调转</el-button>
          <el-button @click="transfer('调回公司')" icon="el-icon-set-up" :disabled="jxAgent">调回公司</el-button>
          <el-button @click="printPreview" icon="el-icon-printer" :disabled="jxAgent">列印预览</el-button></div>
        <div style="margin-top:1vh;">
          <!-- 当上面这个条件有变化时, 就自动查询出来的, 客户调货表'预调'状态的 -->
          <el-table :header-cell-style="{background:'#f4f4f4',padding:0,height:'40px'}" :cell-style="{padding:0,height:'36px'}" :data="tableData2" height="48.5vh" style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="50"></el-table-column>
            <el-table-column prop="kindsNumber" label="货号" width="120"></el-table-column>
            <el-table-column prop="calloutCustomer" label="调出客户" min-width="120"></el-table-column>
            <el-table-column prop="number" label="数量" width="50"></el-table-column>
            <el-table-column prop="foldCustomer" label="调入客户" min-width="120"></el-table-column>
            <el-table-column prop="transferCargoT" label="调货日期" width="120"></el-table-column>
          </el-table>
          <el-table :header-cell-style="{background:'#f4f4f4',padding:0,height:'40px'}" :cell-style="{padding:0,height:'36px'}" :data="tableData3" height="29vh" show-summary :summary-method="getSummaries" style="width: 100%">
            <el-table-column prop="kindsNumber" label="货号" width="160"></el-table-column>
            <el-table-column prop="customerRepertory" label="店内"></el-table-column>
            <el-table-column prop="repertory" label="在外"></el-table-column>
            <el-table-column prop="factoryInput" label="厂进"></el-table-column>
            <el-table-column prop="factoryOut" label="厂退"></el-table-column>
            <el-table-column prop="customerSell" label="累销"></el-table-column>
            <el-table-column prop="inputSellProPortion" label="进销比"></el-table-column>
            <el-table-column prop="factoryOrderHasNotArrived" label="厂订未到"></el-table-column>
          </el-table>
        </div>
      </div>
    </div>
    <div class="mask" v-show="noDistribution"></div>
    <div class="no-distribution" v-show="noDistribution">
      <div class="no-distribution-top">
        <p>未配客户</p>
        <i class="el-icon-close" @click="()=>{this.noDistribution=false}"></i>
      </div>
      <div>
        <span v-for="i in noDistributionList" :key="i">{{i}}</span></div>
    </div>
    <!-- 查看图片 -->
    <div id="imgBox" v-show="showImg">
      <div class="imgTop">
        <span style="line-height:30px;font-weight:bold;">显示图片</span>
        <i class="el-icon-close" @click="()=>{this.showImg=false}"></i>
      </div>
      <div class="img">
        <img :src="imgSrc" ondragstart='return false;'>
      </div>
    </div>
    <!-- 列印框 -->
    <div class="print" v-show="Print">
      <div>列印方式</div>
      <el-radio v-model="radio" label="1">有小图</el-radio>
      <el-radio v-model="radio" label="2">无图</el-radio>
      <div>
        <el-button @click="()=>{this.Print=false}">取消</el-button>
        <el-button @click="openPrint(1)" type="primary">确定</el-button>
      </div>
    </div>
    <div v-show=false id="p"></div>
  </div>
</template>

<script>
const resources = require('../../../config/printCSS2')

import { getClient, integratedQuery, noDistributionCustomers } from '../../../network/client'
import { getCustomerTransfer, getOperatorList, insert, update } from '../../../network/customerTransfer' 
import { getKindsNumberList } from '../../../network/artNo'
import { getBarCode } from '../../../network/manufacturer'
import { getSize } from '../../../network/size'
import {getShop} from '../../../network/shop'
import today from '../../../components/mixins/today'
import enterUp from '../../../components/mixins/enterUp'
import cookieFn from '../../../components/mixins/cookieFn'

export default {
  name: 'client_integrated_query',
  mixins: [today,enterUp, cookieFn],
  data(){
    return {
      inpList: [],
      noDistribution: false,
      Dis:false,
      Dis1:false,
      Dis2:false,
      noDistributionList: [],
      showImg: false,
      imgSrc: '',
      styleNumber: '',
      customerNo: [],
      customerList: [],
      headquartersNo: '',
      headquartersName: '',
      headquartersList: [],
      sellingPrice: '',
      checked: false,
      dateList: null,
      outNo: '',
      outName: '',
      inputNo: '',
      inputName: '',
      inputDate: this.searchDate(-3),
      operator: this.getCookie('jxUser'),
      operatorList: [],
      tableData1:[],
      tableData2:[],
      tableData3:[],

      updateList: [],

      sizeList: [],

      Print: false,
      hasImage: false,
      radio: '1',
      printData: [],
      printSequence: '',
      printInputNo: '',
      printInput: '',
      printOutput: '',
      printdate: '',
      printTime: '',
      printAddress: '',
      printPhone: '',
      printCellPhone: '',
      printToday: '',
      jxAgent: this.getCookie('jxAgent') == 1
    }
  },
  watch: {
    styleNumber(a,b){
      this.styleNumber = a.toUpperCase().trim()
    }
  },
  methods: {
    //实现table表头换行显示
    renderheader(h, { column, $index }) {
      return h('span', {}, [
        h('span', {}, column.label.split('/')[0]),
        h('br'),
        h('span', {}, column.label.split('/')[1])
      ]);
    },
    styleNumberEnter(){
      if (!this.styleNumber) {
        this.$message.error('款号不能为空')
        return
      }
      // let cn = ''
      // if (this.customerNo.length) {
      //   this.customerNo.forEach(e => {
      //     if (!cn) {
      //       cn = `'${e}'`
      //     } else {
      //       cn = `${cn},'${e}'`
      //     }
      //   })
      // }
      integratedQuery({
        // customerNo: cn,
        customerNo: String(this.customerNo),
        headquartersNo: this.headquartersNo,
        styleNumber: this.styleNumber
      }).then(res => {
        if (res.data.code == 200) {
          res.data.data.synthesizeVOMap.sort((a,b) => {
            if (a.customerNo == b.customerNo) {
              return a.colorNo.localeCompare(b.colorNo)
            } else {
              return a.customerNo.localeCompare(b.customerNo)
            }
          })
          res.data.data.synthesizeVOMap.forEach(e => {
            e.colorStr = e.colorNo + '.' + e.colorName
            if (e.nearInputTime) {
              e.nearInputTime = e.nearInputTime.slice(0,10)
            }
            if (e.nearSellTime) {
              e.nearSellTime = e.nearSellTime.slice(0,10)
            }
            for (const key in e) {
              if (e.hasOwnProperty(key)) {
                const element = e[key]
                if (!element) {
                  e[key] = ''
                }
              }
            }
          })
          res.data.data.kindsNumberSynthesizeVOMap.forEach(e => {
            if (e.nearInputTime) {
              e.nearInputTime = e.nearInputTime.slice(0,10)
            }
            if (e.nearSellTime) {
              e.nearSellTime = e.nearSellTime.slice(0,10)
            }
          })
          this.tableData1 = res.data.data.synthesizeVOMap
          this.tableData3 = res.data.data.kindsNumberSynthesizeVOMap
          this.$refs.styleNumberSearch.focus()

          this.$nextTick(() => {
            this.$refs.table1.doLayout()
          })
        } else {
          this.tableData1 = []
          this.tableData3 = []
        }
      })
    },
    transfer(d){
      if (!this.updateList.length) {
        this.$alert('请先选择要修改调转意向的数据', '', {
          confirmButtonText: '确定'
        })
        return
      }
      if (this.updateList.length > 1) {
        this.$alert('禁止同时修改多单', '', {
          confirmButtonText: '确定'
        })
        return
      }
      let list = []
      this.updateList.forEach(e => {
        this.tableData2.forEach(f => {
          if (e == f.transferCargoSequence) {
            if (f.sequenceStatus == '已调') {
              this.$message.error('已调单不可修改')
              return
            }
            f.transferCargoIntention = d
            list.push(f)
          }
        })
      })
      // this.updateList.forEach(e => {
      //   e.transferCargoIntention = d
      // })
      update(JSON.stringify(list)).then(res => {
        if (res.data.code == 200) {
          this.$message({
            message: '修改调转意向成功',
            type: 'success'
          })
        } else {
          this.$message.error('修改调转意向失败')
        }
      })
    },
    printPreview(){
      if (!this.updateList.length) {
        this.$alert('请先选择要列印的数据', '', {
          confirmButtonText: '确定'
        })
        return
      }
      if (this.updateList.length > 1) {
        this.$alert('禁止同时列印多单', '', {
          confirmButtonText: '确定'
        })
        return
      }
      let list = []
      this.updateList.forEach(e => {
        this.tableData2.forEach(f => {
          if (e == f.transferCargoSequence) {
            list.push(f)
          }
        })
      })
      this.printData = list
      this.Print = true
      this.clearPrintArea()
    },

    _getCustomerTransfer(){
      let params = {
        outNo: this.outNo,
        inputNo: this.inputNo,
        operator: this.operator,
        startTime: this.dateList ? this.dateList[0] : '',
        endTime: this.dateList ? this.dateList[1] : ''
      }
      // console.log(params)
      getCustomerTransfer(params).then(res => {
        if (res.data.code == 200) {
          this.tableData2 = []
          res.data.data.customerTransferCargoInfoList.forEach(e => {
            e.transferCargoT = e.transferCargoTime.slice(0,10)
            e.foldCustomer = e.fold + '.' + e.foldName
            if (e.sequenceStatus == '预调') {
              this.tableData2.push(e)
            }
          })
        }
      })
    },

    cellDblclick(row, column, cell, event){
      // if (!this.inputNo) {
      //   this.$alert('调入客户不能为空', '', {
      //     confirmButtonText: '确定'
      //   })
      //   return
      // }
      // console.log(row)
      // console.log(column)
      // console.log(cell)
      // console.log(event)

      if (this.jxAgent) return   // 代理商不能

      if (column.level != 2) return
      let prop = column.property
      if (prop.indexOf('customerRepertory') == -1) return
      prop = prop.slice(17).toLowerCase()
      // console.log(prop)
      if (!prop) return
      
      // console.log(row[column.property])     库存呢
      if (row[column.property]) {
        getKindsNumberList({kindsNumberStr: row.kindsNumber}).then(res => {
          // 品牌公司查条码规律详情
          getBarCode({company:res.data.data.data[0].brandedCompany}).then(res => {
            let manufacturerBarCode = res.data.data[0]
            let f = ''
            let kn = ''
            for (const i of this.sizeList) {
              if (i.kind == manufacturerBarCode.sizeKindId && i.relevanceSize == prop) {
                f = i.size
                break
              }
            }
            // console.log(f)
            if (manufacturerBarCode.styleColorSize) {
              // 型尺色
              if (manufacturerBarCode.styleColor) {
                // 款号与尺码之间有 - 
                if (manufacturerBarCode.colorSize) {
                  // 色号与尺码之间有 - 
                  kn = `${row.styleNumber}-${f}-${row.colorNo}`
                } else {
                  // 色号与尺码之间没有 -  
                  kn = `${row.styleNumber}-${f}${row.colorNo}`
                }
              } else {
                // 款号与尺码之间没有 - 
                if (manufacturerBarCode.colorSize) {
                  // 色号与尺码之间有 -  
                  kn = `${row.styleNumber}${f}-${row.colorNo}`
                } else {
                  // 色号与尺码之间没有 - 
                  kn = `${row.styleNumber}${f}${row.colorNo}`
                }
              }
            } else {
              // 型色尺
              if (manufacturerBarCode.styleColor) {
                // 款号与颜色之间有 - 
                if (manufacturerBarCode.colorSize) {
                  // 色号与尺码之间有 -  
                  kn = `${row.styleNumber}-${row.colorNo}-${f}`
                } else {
                  // 色号与尺码之间没有 -  
                  kn = `${row.styleNumber}-${row.colorNo}${f}`
                }
              } else {
                // 款号与颜色之间没有 - 
                if (manufacturerBarCode.colorSize) {
                  // 色号与尺码之间有 -  
                  kn = `${row.styleNumber}${row.colorNo}-${f}`
                } else {
                  // 色号与尺码之间没有 - 
                  kn = `${row.styleNumber}${row.colorNo}${f}`
                }
              }
            }
            // console.log(kn)
            this.outNo = row.customerNo
            this.outName = row.customerName
            let list = [{
              kindsNumber: kn,
              number: 1,
              transferCargoIntention: '直接调转',
              callout: this.outNo,
              calloutName: this.outName,
              fold: this.inputNo,
              cooperateWay: '配货',
              operator: this.operator,
            }]
            // console.log(list)
            // return
            insert(JSON.stringify(list)).then(res => {
              if (res.data.code == 200) {
                this.$message({
                  message: '调转成功',
                  type: 'success'
                })
                this._getCustomerTransfer()
              } else {
                this.$message.error('调转失败')
              }
            })
          })
        })
      } else {
        this.$alert('库存不足', '', {
          confirmButtonText: '确定'
        })
      }
      
    },
    rowClick(row){
      if (this.checked) {
        // console.log(row)
        if (row.image) {
          this.imgSrc = row.image
          if (this.showImg) return
          let imgBox=document.getElementById("imgBox")
          imgBox.style.left = "650px"
          imgBox.style.top = "70px"
          this.showImg = true
        } else {
          this.imgSrc = ''
          this.$message('暂无图片')
        }
      }
    },
    changeCellStyle({row, column, rowIndex, columnIndex}){
      let sizeStr = ''
      // 红色为退货，黄色为滞销，灰色为调货  把销售做成蓝色
      // console.log(row)                //行的内容
      // console.log(column)            //列的内容
      // console.log(rowIndex)           // 第几行，从0开始
      // console.log(columnIndex)         // 第几列，从0开始

      // 把销售做成蓝色
      if (columnIndex == 5 || columnIndex == 4) {
        return 'background-color:#D5EAFF;padding:0;'
      }
      if (columnIndex > 16 && columnIndex < 28 && row[column.property]) {
        return 'background-color:#D5EAFF;padding:0;'
      }

      // 红色为退货
      if (columnIndex > 5 && columnIndex < 17) {
        sizeStr = column.property.slice(5).toLowerCase()
        if (row.transferOutMap[sizeStr]) {
          return 'background-color:#FED5D6;padding:0;'
        }
      }

      // 黄色为滞销  滞销是三十天没买过的  sellOutList没有的是滞销
      if (columnIndex > 27 && row[column.property]) {
        sizeStr = column.property.slice(17).toLowerCase()
        if (row.sellOutList.length) {
          if (row.sellOutList.indexOf(sizeStr) == -1) {
            return 'background-color:#FEFEA8;padding:0;'
          }
        } else {
          return 'background-color:#FEFEA8;padding:0;'
          return 'padding:0;'
        }
      }

      // 灰色为调货
      if (columnIndex > 27) {
        sizeStr = column.property.slice(17).toLowerCase()
        if (row.transferCargoMap[sizeStr]) {
          return 'background-color:#CCCCCC;padding:0;'
        }
        // for (const key in row.transferCargoMap) {
        //   if (row.transferOutMap.hasOwnProperty(key)) {
        //     if (column.property.indexOf(key.toUpperCase()) != -1) {
        //       return 'background-color:#CCCCCC;padding:0;'
        //     }
        //   }
        // }
      }
      return 'padding:0;'
    },
    showInputToolTip(s){
      // console.log(s)
      if (JSON.stringify(s.row.transferOutMap) == '{}') return true
      for (const key in s.row.transferOutMap) {
        if (s.row.transferOutMap.hasOwnProperty(key)) {
          if (s.column.property.indexOf(key.toUpperCase()) != -1) {  
            return false
          }
        }
      }
      return true
    },
    inputToolTipContent(s){
      // console.log(s)
      if (JSON.stringify(s.row.transferOutMap) == '{}') return
      for (const key in s.row.transferOutMap) {
        if (s.row.transferOutMap.hasOwnProperty(key)) {
          const e = s.row.transferOutMap[key]
          if (s.column.property.indexOf(key.toUpperCase()) != -1) {  
            return e.slice(0,10) + '/调退'
          }
        }
      }
    },

    inventoryToolTipContent(s){
      if (JSON.stringify(s.row.transferCargoMap) == '{}') return
      for (const key in s.row.transferCargoMap) {
        if (s.row.transferCargoMap.hasOwnProperty(key)) {
          const e = s.row.transferCargoMap[key]
          if (s.column.property.indexOf(key.toUpperCase()) != -1) {  
            return e.enteringTime.slice(0,10) + '/调往：' + e.fold
          }
        }
      }
    },
    showInventoryToolTip(s){
      if (JSON.stringify(s.row.transferCargoMap) == '{}') return true
      for (const key in s.row.transferCargoMap) {
        if (s.row.transferOutMap.hasOwnProperty(key)) {
          if (s.column.property.indexOf(key.toUpperCase()) != -1) {
            return false
          }
        }
      }
      return true
    },

    outNoBlur(){
      if (this.outNo) {
        for (const i of this.customerList) {
          if (this.outNo == i.value) {
            this.outName = i.label
            this._getCustomerTransfer()
            return
          }
        }
        this.$alert('无此客户编号', '', {
          confirmButtonText: '确定'
        })
        this.outNo = ''
        this.outName = ''
      } else {
        this.outName = ''
      }
    },
    inputNoBlur(){
      if (this.inputNo) {
        for (const i of this.customerList) {
          if (this.inputNo == i.value) {
            this.inputName = i.label
            this._getCustomerTransfer()
            return
          }
        }
        this.$alert('无此客户编号', '', {
          confirmButtonText: '确定'
        })
        this.inputNo = ''
        this.inputName = ''
      } else {
        this.inputName = ''
      }
    },

    handleSelectionChange(e){
      // this.$refs.tableData2.toggleRowSelection(this.tableData2[3], true)
      // return
      // console.log(e)
      
      let sList = []
      e.forEach(f => {
        if (sList.length) {
          let exist = 0
          for (const i of sList) {
            if (i == f.transferCargoSequence) {
              exist = 1
              break
            }
          }
          if (!exist) {
            sList.push(f.transferCargoSequence)
          }
        } else {
          sList.push(f.transferCargoSequence)
        }
      })
      if (this.updateList.length == sList.length) return
      // console.log(sList)
      this.updateList = sList
      // return
      // this.$refs.tableData2.clearSelection()
      // sList.forEach(f => {
      //   this.tableData2.forEach(g => {
      //     console.log(f.indexOf(g.transferCargoSequence))
      //     if (f.indexOf(g.transferCargoSequence)) {
      //       console.log(g.transferCargoSequence)
      //       this.$refs.tableData2.toggleRowSelection(g, true)
      //     } else {
      //       this.$refs.tableData2.toggleRowSelection(g, false)
      //     }
      //   })
      // })
    },

    noDistributionClick(){
      noDistributionCustomers().then(res => {
        if (res.data.code == 200) {
          this.noDistributionList = res.data.data
          this.noDistribution = true
        }
      })
    },

    getKindsNumber(row,prop){
      // console.log(row)
      if (prop.indexOf('customerRepertory') == -1) return
      prop = prop.slice(17).toLowerCase()
      // console.log(prop)
      if (!prop) return
      getKindsNumberList({kindsNumberStr: row.kindsNumber}).then(res => {
        // 品牌公司查条码规律详情
        getBarCode({company:res.data.data.data[0].brandedCompany}).then(res => {
          let manufacturerBarCode = res.data.data[0]

          let f = ''
          let kn = ''
          for (const i of this.sizeList) {
            if (i.kind == manufacturerBarCode.sizeKindId && i.relevanceSize == prop) {
              f = i.size
              break
            }
          }
          // console.log(f)
          if (manufacturerBarCode.styleColorSize) {
            // 型尺色
            if (manufacturerBarCode.styleColor) {
              // 款号与尺码之间有 - 
              if (manufacturerBarCode.colorSize) {
                // 色号与尺码之间有 - 
                kn = `${row.styleNumber}-${f}-${row.colorNo}`
              } else {
                // 色号与尺码之间没有 -  
                kn = `${row.styleNumber}-${f}${row.colorNo}`
              }
            } else {
              // 款号与尺码之间没有 - 
              if (manufacturerBarCode.colorSize) {
                // 色号与尺码之间有 -  
                kn = `${row.styleNumber}${f}-${row.colorNo}`
              } else {
                // 色号与尺码之间没有 - 
                kn = `${row.styleNumber}${f}${row.colorNo}`
              }
            }
          } else {
            // 型色尺
            if (manufacturerBarCode.styleColor) {
              // 款号与颜色之间有 - 
              if (manufacturerBarCode.colorSize) {
                // 色号与尺码之间有 -  
                kn = `${row.styleNumber}-${row.colorNo}-${f}`
              } else {
                // 色号与尺码之间没有 -  
                kn = `${row.styleNumber}-${row.colorNo}${f}`
              }
            } else {
              // 款号与颜色之间没有 - 
              if (manufacturerBarCode.colorSize) {
                // 色号与尺码之间有 -  
                kn = `${row.styleNumber}${row.colorNo}-${f}`
              } else {
                // 色号与尺码之间没有 - 
                kn = `${row.styleNumber}${row.colorNo}${f}`
              }
            }
          }
          // console.log(kn)
        })
      })
    },

    // 列印
    openPrint(n){
      // console.log('openPrint', n)
      this.Print = false
      if (this.radio == '1') {
        this.hasImage = false
      } else {
        this.hasImage = true
      }
      // console.log(this.hasImage)

      let index = --n
      let printBody = document.getElementById('p')
      let length = this.printData.length
      
      if (!index) {
        let printHead = document.createElement('div')
        if (!this.hasImage) {
          printHead.innerHTML = `
            <p style="margin:5mm auto 0;font-weight: bold;font-size: 18px;">
              客户调货明细表
            </p>
            <div class="printHeader">
              <div class="info">
                <p>调入：${this.printInputNo}.${this.printInput}</p>
                <p>（调出：${this.printOutput}）</p>
                <p>调货日期：${this.printdate}</p>
              </div>
              <div class="info">
                <p>请将下表的货品于：${this.printTime}前寄往下面地址</p>
              </div>
              <div class="info">
                <p>请寄往此地址：${this.printAddress}</p>
              </div>
              <div class="info">
                <p>联系人（收件人）：${this.printInput}</p>
                <p>电话：${this.printPhone}</p>
                <p>手机：${this.printCellPhone}</p>
              </div>
              <div class="info">
                <p>并将货运单传回公司，谢谢合作！祝生意兴隆！</p>
              </div>
              <div class="info">
                <p>打印日期：${this.printToday}</p>
              </div>
            </div>
          `
        } else {
          printHead.innerHTML = `
            <p style="margin:5mm auto 0;font-weight: bold;font-size: 18px;">
              调货通知单
            </p>
            <div class="info">
              <p>运输方式：</p>
              <p>调货序号：${this.printSequence}</p>
            </div>
            <div class="printHeader">
              <div class="info">
                <p>调入：${this.printInputNo}.${this.printInput}</p>
                <p>（调出：${this.printOutput}）</p>
                <p>调货日期：${this.printdate}</p>
              </div>
              <div class="info">
                <p>请将下表的货品于：${this.printTime}前寄往下面地址</p>
              </div>
              <div class="info">
                <p>请寄往此地址：${this.printAddress}</p>
              </div>
              <div class="info">
                <p>联系人（收件人）：${this.printInput}</p>
                <p>电话：${this.printPhone}</p>
                <p>手机：${this.printCellPhone}</p>
              </div>
              <div class="info">
                <p>并将货运单传回公司，谢谢合作！祝生意兴隆！</p>
              </div>
              <div class="info">
                <p>打印日期：${this.printToday}</p>
              </div>
            </div>
          `
        }
        printBody.appendChild(printHead)
      }

      let itemBox = document.createElement('div')
      itemBox.classList.add('printBody')

      for (index; index < length; index++) {
        const e = this.printData[index]
        let itemTable = document.createElement('table')
        itemTable.border = '1'
        itemTable.align = "center" 
        itemTable.classList.add("printItem")
        itemTable.style.marginTop = '5px'
        if (!this.hasImage) {
          itemTable.innerHTML = `
            <tr>
              <td>No.</td>
              <td>${e.kindsNumber} ${e.colorName}</td>
            </tr>
            <tr>
              <td>数量</td>
              <td>${e.number}</td>
            </tr>
            <tr>
              <td>售价</td>
              <td>${e.sellingPrice}</td>
            </tr>
            <tr>
              <td>品牌</td>
              <td>${e.brandedName}</td>
            </tr>
            <tr>
              <td>${e.commodityName}</td>
              <td style='overflow:hidden;'>
                <img src="${e.image}">
              </td>
            </tr>
          `
          itemBox.appendChild(itemTable)
          if (parseInt((index+1)/6) && (index+1)%6 == 0 && (index+1) != length) {
            // 到6了
            printBody.appendChild(itemBox)

            let printFoot = document.createElement('div')
            printFoot.classList.add('printFoot')
            printFoot.innerHTML = `
              <div class="info">
                <p>本页合计：6</p>
              </div>
              <div class="info">
                <p>请务必配合调货，并附带明细，快递单号传回本公司。</p>
              </div>
              <div class="info">
                <p>若已销售请通知本公司业务，谢谢！</p>
                <p>制单员：${this.printOperator}</p>
              </div>
              <div class="info">
                <p>备注：${this.printRemark}</p>
              </div>
            `
            printBody.appendChild(itemBox)
            printBody.appendChild(printFoot)
            let printHead = document.createElement('div')
            printHead.innerHTML = `
              <p style="margin:5mm auto 0;font-weight: bold;font-size: 18px;">
                客户调货明细表
              </p>
              <div class="printHeader">
                <div class="info">
                  <p>调入：${this.printInputNo}.${this.printInput}</p>
                  <p>（调出：${this.printOutput}）</p>
                  <p>调货日期：${this.printdate}</p>
                </div>
                <div class="info">
                  <p>请将下表的货品于：${this.printTime}前寄往下面地址</p>
                </div>
                <div class="info">
                  <p>请寄往此地址：${this.printAddress}</p>
                </div>
                <div class="info">
                  <p>联系人（收件人）：${this.printInput}</p>
                  <p>电话：${this.printPhone}</p>
                  <p>手机：${this.printCellPhone}</p>
                </div>
                <div class="info">
                  <p>并将货运单传回公司，谢谢合作！祝生意兴隆！</p>
                </div>
                <div class="info">
                  <p>打印日期：${this.printToday}</p>
                </div>
              </div>
            `
            
            printHead.style.pageBreakBefore = 'always'
            printBody.appendChild(printHead)
            this.openPrint(index+2)
            return
          }
        } else {
          itemTable.innerHTML = `
            <tr>
              <td>No.</td>
              <td colspan="2">${e.kindsNumber} ${e.colorName}</td>
            </tr>
            <tr>
              <td>数量</td>
              <td style='width:10mm'>${e.number}</td>
              <td>统一零售价：${e.sellingPrice}</td>
            </tr>
          `
          itemBox.appendChild(itemTable)
          if (parseInt((index+1)/24) && (index+1)%24 == 0 && (index+1) != length) {
            // 到24了
            printBody.appendChild(itemBox)

            let printFoot = document.createElement('div')
            printFoot.classList.add('printFoot')
            printFoot.innerHTML = `
              <div class="info">
                <p>本页合计：24</p>
              </div>
              <div class="info">
                <p>请务必配合调货，并附带明细，快递单号传回本公司。</p>
              </div>
              <div class="info">
                <p>若已销售请通知本公司业务，谢谢！</p>
                <p>制单员：${this.printOperator}</p>
              </div>
              <div class="info">
                <p>备注：${this.printRemark}</p>
              </div>
            `
            printBody.appendChild(itemBox)
            printBody.appendChild(printFoot)
            let printHead = document.createElement('div')
            printHead.innerHTML = `
              <p style="margin:5mm auto 0;font-weight: bold;font-size: 18px;">
                调货通知单
              </p>
              <div class="info">
                <p>运输方式：</p>
                <p>调货序号：${this.Sequence}</p>
              </div>
              <div class="printHeader">
                <div class="info">
                  <p>调入：${this.printInputNo}.${this.printInput}</p>
                  <p>（调出：${this.printOutput}）</p>
                  <p>调货日期：${this.printdate}</p>
                </div>
                <div class="info">
                  <p>请将下表的货品于：${this.printTime}前寄往下面地址</p>
                </div>
                <div class="info">
                  <p>请寄往此地址：${this.printAddress}</p>
                </div>
                <div class="info">
                  <p>联系人（收件人）：${this.printInput}</p>
                  <p>电话：${this.printPhone}</p>
                  <p>手机：${this.printCellPhone}</p>
                </div>
                <div class="info">
                  <p>并将货运单传回公司，谢谢合作！祝生意兴隆！</p>
                </div>
                <div class="info">
                  <p>打印日期：${this.printToday}</p>
                </div>
              </div>
            `
            
            printHead.style.pageBreakBefore = 'always'
            printBody.appendChild(printHead)
            this.openPrint(index+2)
            return
          }
        }

        if ((index+1) == length) {
          // 最后一行
          // console.log('最后一行')
          printBody.appendChild(itemBox)

          let lastNum
          if (!this.hasImage) {
            lastNum = length - (parseInt(length/6) * 6)
          } else {
            lastNum = length - (parseInt(length/24) * 24)
          }
          let printFoot = document.createElement('div')
          printFoot.classList.add('printFoot')
          printFoot.innerHTML = `
            <div class="info">
              <p>本页合计：${lastNum}</p>
            </div>
            <div class="info">
              <p>请务必配合调货，并附带明细，快递单号传回本公司。</p>
            </div>
            <div class="info">
              <p>若已销售请通知本公司业务，谢谢！</p>
              <p>制单员：${this.printOperator}</p>
            </div>
            <div class="info">
              <p>备注：${this.printRemark}</p>
            </div>
          `
          printBody.appendChild(itemBox)
          printBody.appendChild(printFoot)
        }
      }

      let printHtml = document.getElementById('p').innerHTML
      let wind = window.open("",'newwindow', 'height=500, width=1000, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
      wind.document.body.innerHTML = printHtml
      let style = document.createElement('style')
      style.type = 'text/css'
      style.innerHTML = resources.printCSS
      wind.document.head.appendChild(style)
      wind.print()
    },
    clearPrintArea(){
      document.getElementById('p').innerHTML = ''
    },

    getSummaries(param){
      const { columns, data } = param
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
          return
        }
        const prop = column.property
        const values = data.map(item => Number(item[prop]))
        if (!values.every(value => isNaN(value))) {
          if (prop == 'customerRepertory' || prop == 'repertory' 
          || prop == 'factoryInput' || prop == 'factoryOut' 
          || prop == 'customerSell' || prop == 'factoryOrderHasNotArrived') {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
            if (!sums[index]) {
              sums[index] = ''
            }
            let decimal = sums[index].toString().split('.')[1]
            if (decimal && decimal.length > 2) {
              sums[index] = sums[index].toFixed(2)
            }
          }
        }
      })
      return sums
    }
  },
  created(){
    if(localStorage.getItem('isStore') == 'true'){
      this.Dis = true
      this.Dis2 = true
      this.Dis1 = true
      getShop().then(res=>{
        console.log(res.data)
        this.outNo = res.data.data.no
        this.outName = res.data.data.name
        this.customerNo = res.data.data.no
      });
    }else{
      this.Dis = false
      this.Dis1 = false
      this.Dis2 = false
    }
    this.inpList = this.getInput()
    // 获取所有客户信息
    this.customerList = []
    getClient({limit:99999}).then(res => {
      if (res.data.code == 200) {
        let list = res.data.data
        list.forEach(e => {
          if(e.stop != 1){
            this.customerList.push({value:e.no,label:e.name})
          }
          if (this.headquartersList.length) {
            let exist = 0
            for (const i of this.headquartersList) {
              if (i.value == e.headquartersNo) {
                exist = 1
                break
              }
            }
            if (!exist) {
              this.headquartersList.push({value:e.headquartersNo,label:e.headquartersNo})
            }
          } else {
            this.headquartersList.push({value:e.headquartersNo,label:e.headquartersNo})
          }
        })
        if (this.jxAgent) {
          for (const i of this.customerList) {
            if (i.label == this.operator) {
              this.customerNo = [i.value]
              break
            }
          }
        }
      }
    })
    
    // 操作员
    getOperatorList().then(res => {
      if (res.data.code == 200 && res.data.data.length) {
        res.data.data.forEach(e => {
          this.operatorList.push({value:e,label:e})
        })
      }
    })

    getSize().then(res => {
      this.sizeList = res.data.data
    })
  },
  mounted(){
    imgBox.onmousedown = function(event){
      let imgBox=document.getElementById("imgBox")
      let rex=event.clientX - imgBox.offsetLeft
      let rey=event.clientY - imgBox.offsetTop
      document.onmousemove = e=>{ 
        let xX = 0
        let yY = 0
        xX=e.clientX
        yY=e.clientY
        imgBox.style.left = (xX-rex) + "px"
        imgBox.style.top = (yY-rey) + "px"
      }
    }
    document.onmouseup=()=>{
      document.onmousemove = null
    }
  }
}
</script>

